package com.lcz.study_designmode.结构型模式.享元模式;

import java.util.HashMap;

/**
 * <pre>
 * <img width="128" height="110" src="https://tse3-mm.cn.bing.net/th/id/OIP-C.en-w_oH-yn2UsSRfWnOsGAHaGY?w=198&h=180&c=7&r=0&o=5&dpr=1.25&pid=1.7" alt="马刺">
 * 作者:     <a href="https://github.com/liuchuanzheng">刘传政</a>
 * 创建时间:  14:53 2022/6/13 0013
 * QQ:      1052374416
 * 电话:     18501231486
 * 描述:
 * </pre>
 */
public class BoxFactory {
    private HashMap<String, AbstractBox> map;

    private BoxFactory() {
        map = new HashMap<>();
        map.put("I", new IBox());
        map.put("L", new LBox());
        map.put("O", new OBox());
    }

    private static BoxFactory instance = new BoxFactory();

    public static BoxFactory getInstance() {
        return instance;
    }

    public AbstractBox getShape(String name) {
        return map.get(name);
    }

}
